package TeachLesson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;

@WebServlet(name = "AddKonwServlet")
public class AddKonwServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //添加知识点
        String workerNo=request.getParameter("workerNo");
        String courseNo=request.getParameter("courseNo");
        String point=request.getParameter("point");
        String dirName=request.getParameter("dirName");

        String filePath="F:\\JWGLXT\\web\\StoreResoures\\"+workerNo+"\\"+courseNo+"\\"+dirName+'\\'+point;
        File file=new File(filePath);
        if(!file.exists()){
            file.mkdirs();
        }
        response.sendRedirect("/Teachers/konwLedgePoint.jsp?dirName="+ URLEncoder.encode(dirName,"UTF-8"));
    }
}
